Skip to content

Harden document parsing security defaults#1934

Merged
PrzemyslawKlys merged 18 commits into
masterfrom
codex/security-posture-hardening
Jun 17, 2026
Merged

Harden document parsing security defaults#1934
PrzemyslawKlys merged 18 commits into
masterfrom
codex/security-posture-hardening

Conversation

@PrzemyslawKlys

@PrzemyslawKlys PrzemyslawKlys commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

  • make Markdown-to-PDF local image embedding opt-in by default so untrusted Markdown cannot read local files unless callers explicitly allow it
  • cap PDF CMap and CID width range expansion to prevent attacker-controlled font metadata from creating unbounded dictionaries
  • cap recursive PowerPoint group-shape rendering during PDF export and secure Visio XML validation readers against DTD/entity expansion
  • bound HTML-to-Word table span expansion by default and clamp colgroup width expansion to resolved table columns
  • add focused regression coverage for Markdown local images, PDF font expansion, PowerPoint group depth, Visio DTD handling, and HTML table span limits

Validation

  • dotnet test OfficeIMO.Tests\OfficeIMO.Tests.csproj --no-restore --filter "FullyQualifiedNameMarkdownPdfTests|FullyQualifiedNamePdfFontSecurityTests|FullyQualifiedNamePowerPointSaveAsPdfSecurityTests|FullyQualifiedNameVisioValidation|FullyQualifiedNameConversionOptionsTests|FullyQualifiedNameHtml.HtmlToWord_MaxTableCells|FullyQualifiedNameHtml.HtmlToWord_DefaultMaxTableCells|FullyQualifiedNameHtml.HtmlToWord_ColumnGroupSpan"

Notes

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.66366% with 242 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.33%. Comparing base (e41b6e5) to head (e508095).

Files with missing lines Patch % Lines
OfficeIMO.Pdf/Rendering/Writer/PdfWriter.Images.cs 51.58% 34 Missing and 27 partials ⚠️
OfficeIMO.Pdf/Reading/Filters/FlateDecoder.cs 44.44% 25 Missing and 5 partials ⚠️
OfficeIMO.Pdf/Reading/Filters/Ascii85Decoder.cs 55.26% 9 Missing and 8 partials ⚠️
OfficeIMO.Pdf/Reading/Filters/StreamDecoder.cs 60.00% 7 Missing and 9 partials ⚠️
...rd.Pdf/WordPdfConverterExtensions.Native.Charts.cs 72.41% 10 Missing and 6 partials ⚠️
...IMO.Pdf/Core/PdfDocument.Blocks.ImageValidation.cs 13.33% 13 Missing ⚠️
...Pdf/Rendering/Writer/PdfWriter.Images.Interlace.cs 45.83% 8 Missing and 5 partials ⚠️
OfficeIMO.Pdf/Reading/Font/ToUnicodeCMap.cs 33.33% 5 Missing and 7 partials ⚠️
...fficeIMO.Html/Rtf/Internal/RtfHtmlReader.Fields.cs 85.89% 2 Missing and 9 partials ⚠️
...rdPdfConverterExtensions.Native.FootnotesImages.cs 21.42% 10 Missing and 1 partial ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1934      +/-   ##
==========================================
- Coverage   73.35%   73.33%   -0.03%     
==========================================
  Files        2521     2521              
  Lines      283393   283933     +540     
  Branches    60640    60803     +163     
==========================================
+ Hits       207882   208221     +339     
- Misses      47871    47986     +115     
- Partials    27640    27726      +86     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72ed7253ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread OfficeIMO.Pdf/Reading/Core/PdfReadDocument.XmpMetadata.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a635aace7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread OfficeIMO.Pdf/Reading/Filters/StreamDecoder.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d10e539e0b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread OfficeIMO.Pdf/Rendering/Writer/PdfWriter.Images.cs
Comment thread OfficeIMO.Pdf/Reading/Filters/StreamDecoder.cs
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd0c328874

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread OfficeIMO.Word.Pdf/WordPdfConverterExtensions.Native.Charts.cs
Comment thread OfficeIMO.Html/Rtf/Internal/RtfHtmlReader.Fields.cs Outdated
Comment thread OfficeIMO.Pdf/Reading/Font/ToUnicodeCMap.cs Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@PrzemyslawKlys PrzemyslawKlys merged commit 7101ed5 into master Jun 17, 2026
20 checks passed
@PrzemyslawKlys PrzemyslawKlys deleted the codex/security-posture-hardening branch June 17, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant